<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        //返回结果是 promise 对象
        async function main(){
            //1. 返回不是 promise 对象
            // return 123;
            //2. 返回是 promise 对象
            // return new Promise((resolve, reject) => {
            //     // resolve('OK');
            //     reject('失败');
            // });
            //3. 抛出错误
            throw '有点问题!!';
        }

        main()
        .then(v => {
            console.log(v);
        }).catch(r => {
            console.error(r);
        })


    </script>
</body>
</html>